package cn.itsource.controller.remote;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.itsource.api.openfeign.LoginOpenfeign;
import cn.itsource.pojo.LoginRo;
import cn.itsource.pojo.domain.Login;
import cn.itsource.pojo.dto.LoginRoToLoginDto;
import cn.itsource.result.JSONResult;
import cn.itsource.service.ILoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
public class LoginOpenfeignImpl implements LoginOpenfeign {
    @Autowired
    private ILoginService loginService;
    @Override
    @SaIgnore
    public JSONResult createLogin(LoginRo login) {
        Login tologin = LoginRoToLoginDto.tologin(login);
        loginService.save(tologin);
        return JSONResult.success();
    }
}
